import React, { Component } from 'react';
import { connect } from 'react-redux';

import { actionCreators } from '../../otherReducer/list';
import ListCard from '../listCard';

class Boss extends Component {

    render() {     
        const { userList } = this.props;
        const newlist = [];
        for (let i = 0; i < userList.length; i ++) {
            newlist.push(userList[i])
        }
        return <ListCard userlist={newlist}></ListCard>
    }

    componentDidMount() {
        this.props.getUserList('personage');
    }

}

const mapStateToProps = (state) => ({
    userList: state.getIn(['list', 'userList'])
})

const mapDispatchToProps = (dispatch) => ({
    getUserList(type) {
        dispatch(actionCreators.getUserList(type));
    }
})

export default connect(mapStateToProps, mapDispatchToProps)(Boss);